package seventeen.observer.homework;

import java.util.ArrayList;
import java.util.Iterator;

public abstract class Program {
    private ArrayList observers = new ArrayList();
    public void addObserver(Observer observer){observers.add(observer);}
    public void deleteObserver(seventeen.observer.example.Observer observer){
        observers.remove(observer);
    }
    public void notifyObservers(){
        Iterator iterator = observers.iterator();
        while (iterator.hasNext()){
            Observer o =(Observer) iterator.next();
            o.error(this);
        }
    }
    public abstract String getError();
    public abstract void execute();
}
